The disclosure generally focuses on localizing (e.g., finding) and decoding (e.g., reading) machine-readable indicia, such a 1-D and 2-D barcodes. While specific examples are provided for 1-D barcodes (e.g., so-call Universal Product Codes or UPC), the disclosed technology can be readily used for other types of 1-D (e.g., EAN-13, EAN-8, Code128, ITFR-14, Code39, DataCodes, etc.) and 2-D (e.g., QR code, Aztec, Code 49, DataMatrix, etc.) symbologies.
A Universal Product Code (or UPC) is a barcode symbology that is used primarily for retail items. UPC codes include two formats, UPC-A (conveying 12 numerical digits) and UPC-E (conveying 6 numerical digits). With reference to FIGS. 4 & 5, a UPC-A barcode includes a plurality of black bars and white spaces, with each digit (or “symbol”) represented by a unique pattern of two bars and two spaces. These bars and spaces can have various widths, more than two elements, however. The horizontal dimensional parameter is called the x-dimension, and includes the preferred width of a single “module” element. A single x-dimension element is uniform within a UPC barcode. The bars and spaces can include variable width as long as the width remains uniform across the x-dimension; for example, they may be one, two, three, or four modules wide. The total width for a digit includes seven modules. For example, the left-hand “4” digit is space×1, bar×1, space×3, bar×2. To represent 12 digits of UPC-A code, 7 modules×12 digits=84 modules.
With reference to FIG. 5A, dark bars form Start (S), Middle (M), and End (E) guard bars and extend downwards by about 5 times the x-dimension. A quiet zone is included on each side of the scannable area of the UPC-A barcode. UPC-A includes 95 modules: 84 modules for the digits (L and R) and 11 modules for the start, middle, and end (S, M, and E) patterns. The S and E patterns are three modules wide and use the pattern bar-space-bar; each bar and space is one module wide. The M pattern is five modules wide and uses the pattern space-bar-space-bar-space; each bar and space is one module wide. In addition, a UPC code includes a quiet zone (additional space modules) before the S pattern and another quiet zone after the E pattern. The UPC's left-side digits (the digits to the left of the middle guard bars) have odd parity, which means the total width of the black bars is an odd number of modules. The right-hand side digits have even parity. UPC scanners can determine whether it is scanning a UPC from left-to-right or from right-to-left by considering the parity.
A few binary patterns for some left and right digits (or “symbols”) (2, 5, 0) are shown with reference to FIGS. 5B and 5C. Recall from above that each bar (b) and space (s) is one module wide for a UPC. For a left side “2” digit, the bit pattern is “ssbssbh” or 0010011. For a right side “2” digit (or “symbol”), the bit pattern is “bbsbbss” or 1101100. In another example, the left side “0” bit pattern is “sssbbsb” or 0001101, with the right side “0” pattern is “bbbssbs” or 1110010. You'll notice that the left and right side digits are bitwise complements. A full table for all such left and right digits is provided herein.
UPC-A barcodes include the pattern “SLLLLLLMRRRRRRE” where the S (start), M (middle), and E (end) guard bars are represented the same on each UPC and the L (6 digits left) and R (6 digits right) sections collectively represent unique 12 numerical symbols or digits. The first digit L indicates a particular number system to be used by the following digits. The last digit R is an error detecting check digit that provides error detection.
An EAN-1.3 barcode is a 13 symbol (12 data and 1 check) barcode standard which is a superset of the 12-digit UPC-A system. To encode an EAN-13 barcode, the digits are split into 3 groups; the first digit, the first group of 6 digits and the last group of 6 digits. If the first digit is zero, all digits in the first group of six are encoded using the patterns used for UPC, therefore, a UPC barcode is also an EAN-13 barcode with the first digit set to zero. Otherwise, for EAN-13, the first group of six is encoded using a scheme whereby each digit has two possible encodings, one of which has even parity and one of which has odd parity. All digits in the last group of six digits are encoded using a single set of patterns which are the same patterns used for UPC. For easy of discussion, we'll focus on the UPC-A case. However, it should be understood that the technology disclosed herein is applicable to other EAN-13 formats as well.
One aspect of the present technology is an image processing apparatus comprising: an image sensor for obtaining data representing imagery; memory for storing a plurality of barcode symbol templates, and one or more configured processors. The plurality of barcode symbol templates comprises a template for each numerical digit 0-9 and one or more templates for synchronization symbols, wherein for each of the numerical digits the plurality of templates comprises one or more scaled versions of the digit template, and wherein the symbol template comprises a plurality of elements. The one or more processors are configured for: analyzing a scanline representing a portion of the data representing imagery by correlating information associated with one or more suspected barcode symbols within the scanline with the plurality of barcode symbol templates, updating an estimated scale of the scanline based upon a result of said correlating; and outputting a barcode ID associated with the scanline.
Another aspect of the technology includes a method for constructing a symbol template for use by a 1-dimensional (1D) barcode decoder, the barcode decoder configured for processing image data suspected of including a 1D barcode, said method comprising: obtaining a first symbol pattern representing a first symbol, the first symbol pattern comprising a plurality of elements, with each element corresponding to a ID barcode space or bar; obtaining prefix elements, the prefix elements comprising a subset of second symbol elements from a second symbol pattern which precedes the first symbol from within a scanline of image data; extending the first symbol pattern with the prefix to yield an overlapping symbol template; and providing the overlapping symbol template for use in correlation-based barcode decoding by the 1D barcode decoder.
Still another aspect includes an image processing method comprising: obtaining 2D image data representing a 1D barcode within a first image area; generating a plurality of scanlines across the first image area; for each of the plurality of scanlines: synchronizing the scanline, including decoding an initial set of numerical digits represented by the scanline, in which said synchronizing provides a scale estimate for the scanline; using a path decoder to decode remaining numerical digits within the scanline, the path decoder decoding multiple numerical digits in groups; and providing decoded numerical digits as an identifier represented by the scanline.
This disclosure also includes a description for advanced image processing technology including: i) rapid localization for machine-readable indicia including, e.g., D and 2-D barcodes; and ii) barcode reading and decoders.
Of course these and many other aspects, features and embodiments are described in detail herein.